package com.Jano.service.impl;

import com.Jano.mapper.PermissionMapper;
import com.Jano.model.PermissionModel;
import com.Jano.service.PermissionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * description: PermissionServiceImpl <br>
 * date: 2022/7/10 11:04 PM <br>
 * author: zoumaoji <br>
 * version: 1.0 <br>
 */

@Service
@Transactional(readOnly = true)
public class PermissionServiceImpl extends AbstractBaseServiceImpl implements PermissionService {
    @Autowired
    PermissionMapper permissionMapper;

    /**
     * 根据用户名查找权限
     * @param userName
     * @return java.util.List<com.Jano.model.PermissionModel>
     * @author zoumaoji
     * @date 2022/07/15 17:12
     */
    @Override
    public List<PermissionModel> findByUsername(String userName) {
        throwIfBlank(userName, "用户名不能为空");
        return permissionMapper.findPermissionsByUserName(userName);
    }
}
